;
define([ 'suredyModal' ], function(Modal) {
	$(document).off('click', '.my-apps .create-contract-and-link-bid');
	$(document).on('click', '.my-apps .create-contract-and-link-bid', function() {
		Modal.showModal({
			size : 'lg',
			// showCancelBtn : false,
			title : '请选择需要关联的投标信息',
			okText : '下一步',
			uri : Suredy.contextPath + '/app/front-page/get-bid-for-link-contract.html',
			okClick : function() {
				var radio = $('.bids-for-sign-contract [name="bid-id"]:checked');

				if (radio.length <= 0) {
					alert('关联的投标信息【无效】！');
					return false;
				}

				var tr = radio.parent().parent();

				var msg = '确定关联投标信息：\n\n';
				msg += '【' + tr.find('>td.project-no').text() + '】';
				msg += tr.find('>td.name').text();

				if (!confirm(msg)) {
					return false;
				}

				var id = radio.val();

				$('body>div.modal.suredy-modal').one('hidden.bs.modal', function() {
					Modal.showModal({
						size : 'lg',
						icon : 'icon-plus',
						title : '新建合同',
						showFoot : false,
						uri : Suredy.contextPath + '/contract/create-by-bid?bidId=' + id
					});
				});

				Modal.closeModal();
			}
		});
	});
});
